/*
* Copyright (c) 2012 Kyle Hayward
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#pragma once

#include "Program.h"

namespace OptixDotNet 
{
	/// <summary>
	/// Enum containing the different types of surface-ray intersections
    /// </summary>
	public enum class RayHitType
	{
		/// <summary>
		/// Optix will return the first surface it intersects with Any hit ray types
		/// </summary>
		Any,

		/// <summary>
		/// Optix will return the closest surface it intersects with Closest hit ray types
		/// </summary>
		Closest
	};

	/// <summary>
	/// A <see cref="OptixDotNet::Program">Program</see> representing a Surface shader program. Called when a ray intersects a surface.
    /// </summary>
	public ref class SurfaceProgram : Program
	{
	public:
		/// <summary>
		/// Creates a program located at [filename] with main function [programName]
        /// </summary>
		/// <param name="context">Context with which to create the program.</param>
		/// <param name="type">Type of ray this program represents. <seealso cref="OptixDotNet::RayHitType"></seealso></param>
		/// <param name="filename">Path of the compiled cuda ptx file holding the program.</param>
		/// <param name="programName">Name of the main function of the program.</param>
		SurfaceProgram( Context^ context, RayHitType type, System::String^ filename, System::String^ programName );

		property RayHitType RayType
		{
			inline RayHitType get() { return mRayType; }
		}

	internal:
		SurfaceProgram( Context^ context, RayHitType type, RTprogram program );

	protected:
		RayHitType mRayType;
	};
}